package com.sgb.goods.widget.pop.adapter;

import android.view.View;

import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.entity.OrderDynamicEntity;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;

/**
 * 订单动态适配器
 * @author cyj
 */
public class OrderDynamicAdapter extends BaseCommonAdapter<OrderDynamicEntity.OrderDynamicRecords> {

    public OrderDynamicAdapter() {
        super(R.layout.goods_item_pop_order_dynamic, BR.entity);
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, OrderDynamicEntity.OrderDynamicRecords entity) {
        if (baseHolder.getLayoutPosition() == getData().size() - 1) {
            baseHolder.getView(R.id.last_line).setVisibility(View.VISIBLE);
        } else {
            baseHolder.getView(R.id.last_line).setVisibility(View.GONE);
        }
        if (baseHolder.getLayoutPosition() == 0) {
            baseHolder.getView(R.id.line2).setVisibility(View.INVISIBLE);
        } else {
            baseHolder.getView(R.id.line2).setVisibility(View.VISIBLE);
        }
    }
}
